package com.myWeb.controller;

import com.myWeb.dao.QuestionDao;
import com.myWeb.entity.Question;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class QuestionFindByIdServlet extends HttpServlet {

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        int questionId = Integer.valueOf(request.getParameter("questionId"));
        QuestionDao dao = new QuestionDao();
        Question question = dao.findById(questionId,request);
        request.setAttribute("key",question);
        request.getRequestDispatcher("/question_update.jsp").forward(request,response);

    }
}
